require('../css/advertisement.less')
require('../fonts/iconfont.css')

document.ready(function () {
    let count_down = document.querySelector(".count-down")
    let nost = document.querySelector(".nost")
    let skip = document.querySelector(".skip")
    let enter_page = document.querySelector(".enter-page")
    let loginbtn = document.querySelector(".loginbtn")
    let inp11 = document.querySelector(".inp11")//账号
    let mimadenlu = document.querySelector(".mimadenlu")//密码
    setInterval(function () {
        let minute = count_down.innerHTML;
        minute--;
        count_down.innerHTML = minute;
        if (minute === 0) {
            minute = 6;
            nost.classList.add("shou")
            enter_page.classList.remove("conceal")
        }
    }, 1000)

    loginbtn.addEventListener("click", function () {

        // 请求注册接口
        $http.post('/users/login', {
            account: inp11.value,//获取表单的值
            password: mimadenlu.value
        }, function (res) {
            if (res.status === 0) { // 请求成功
                console.log(res)
                // 思考题：如何实现注册后的自动登录
            } else {
                console.log('登陆失败');
            }
        }
        )

    })
    skip.addEventListener("click", function (en) {
        nost.classList.add("shou")
        enter_page.classList.remove("conceal")
    })//zhu注册按钮点击跳转
    let account = document.querySelector(".account")
    account.addEventListener("click", function (en) {
        location.href = "./register.html"
    })
})